﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Zen4SyncModel
{
    public interface ILogger
    {

        /// <summary>
        /// Persists information of a ClientSession entity on its IsReadyToStart state.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="processId">Identifier of the process.</param>
        /// <param name="datetime">Date and time when the ClientSession is ready to start.</param>
        void ClientSessionIsReadyToStart( Guid clientSessionId, int processId, DateTime datetime );

        /// <summary>
        /// Persists information of a ClientSession entity on its Started state.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="dateTime">Date and time when the ClientSession is started.</param>
        void ClientSessionStarted( Guid clientSessionId, DateTime dateTime );

        /// <summary>
        /// Persists information of a ClientSession entity when it is enabled to start.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="error">Error message.</param>
        void ClientSessionUnableToStart( Guid clientSessionId, string error );

        /// <summary>
        /// Persists information of a ClientSession entity on its Ended state.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="dateTime">Date and time when the ClientSession ended its work.</param>
        void ClientSessionEndedSuccessfully( Guid clientSessionId, DateTime dateTime );

        /// <summary>
        /// Persists information of a ClientSession entity on its EndedWitheError state.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="dateTime">Date and time when the ClientSession ended its work with an error.</param>
        /// <param name="exceptionMessage">Error message.</param>
        void ClientSessionEndedWithError( Guid clientSessionId, DateTime dateTime, string exceptionMessage );

        /// <summary>
        /// Creates the activityHistory entity associated with an Activity.
        /// Persists information on the Started state of the Activity by updating the associated activityHistory entity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="dateTime">Date and time when the activity starts.</param>
        void ActivityStarted( Guid clientSessionId, Guid activityId, DateTime dateTime );

        /// <summary>
        /// Persists information on the Ended state of an Activity by updating the associated activityHistory entity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="dateTime">Date and time when the activity ends.</param>
        void ActivityEndedSuccessfully( Guid clientSessionId, Guid activityId, DateTime dateTime );

        /// <summary>
        /// Persists information on the EndedWithError state of an Activity by updating the associated activityHistory entity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="dateTime">Date and time when the activity ends with an error.</param>
        /// <param name="exceptionMessage">Error message.</param>
        void ActivityEndedWithError( Guid clientSessionId, Guid activityId, DateTime dateTime, string exceptionMessage );

        /// <summary>
        /// Creates and persists the mefExecutionHistory entity associated to an Activity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="metadata">Metadata of the activity.</param>
        void LogMefExecution( Guid clientSessionId, Guid activityId, string metadata );

        /// <summary>
        /// Creates and persists the sqlceExecutionHistory entity associated to an Activity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="sqlceExecutionContext">Execution context of the sqlceExecution.</param>
        void LogSqlCEexecution( Guid clientSessionId, Guid activityId, sqlceExecutionContext sqlceExecutionContext );

        /// <summary>
        /// Creates and persists the sqlServerExecutionHistory entity associated to an Activity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="sqlServerExecutionContext">Execution context of the sqlServerExecution.</param>
        void LogSQLServerExecution( Guid clientSessionId, Guid activityId, sqlServerExecutionContext sqlServerExecutionContext );

        /// <summary>
        /// Creates and persists the sqlceBackupHistory entity associated to an Activity.
        /// </summary>
        /// <param name="clientSessionId">Unique identifier of the ClientSession.</param>
        /// <param name="activityId">Unique identifier of the activity.</param>
        /// <param name="sqlCeDatabase">The sqlceDatabase file as a byte array.</param>
        void LogBackupActivity( Guid clientSessionId, Guid activityId, byte[] sqlCeDatabase );
    }
}
